<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/includes.jsp" %>
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
    <title>盘点上传</title>
    <!-- import css and js -->
	<%@ include file="/common/metaInput.jsp" %>  
	<script src="${ctx}/js/jsp/comm.js" type="text/javascript"></script>
	<script type="text/javascript" src="${ctx}/js/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript">
	var basic_Url="${ctx}/yd/logic/whcheck";
	$(function(){
		$("#inputForm").validate({			   
			onsubmit: true,
			 /*执行ajaxsubmit  */ 
		    submitHandler: function(editform) {
		        try{			    		
		            url =  basic_Url+"/uploadsave.do";
		            var api = frameElement.api;
		        	var W = api.opener;
		            getReturnMessage(url,"inputForm",W.searchAP);
		        }catch(e){alert(e);}
		    }
		});
		
		 $("#storage").change(function(){ 
		    	<c:forEach items='${wh}' var='state'>
		    		if($("#storage").find("option:selected").text()=='${state.name}'){
		    			$("#whCode").val('${state.code}');
		    			$("#whName").val('${state.name}'); 
		    		}
				</c:forEach>
		}); 
	});	
	 function submitForm(param){
	    //设置ajax全局同步
		/* if($("#storage").val()==null||$("#storage").val()==""){
			$.dialog.alert("请选择仓库!");
	   	 	return false;
		} */
		var ba=true;
		jQuery.ajaxSettings.async = false;
		if(ba){
		  	$("#submitFlag").val(param);
		    $("#inputForm").submit();
		}
	 }	
	</script>
  </head>
 <body>  
 <form id="inputForm" action="" method="post"  enctype="multipart/form-data">
<!-- 用于标识提交按钮 -->
<input type="hidden" id="submitFlag" value="" />
 <div class="pageContent" >
    <table class="TableBlock" align="center">
   		           <tr>
   		           		<td>任务单号：</td>
   		           		<td> <input type="text" id="oriCode" name="oriCode" value="" class="required"/></td>
                    	<td nowrap>选择仓库:</td>
                    	<td><select id="storage" name="storage" class="required">
   		                 	<option></option>
   		                 	<c:forEach items='${wh}' var='state'>
   		                 	<option id="${ state.code}" value='${state.code}'>${state.name}</option>
   		                 	</c:forEach>
   		                 	</select>
   		                 	<input type="hidden" id="whName" name="whName" value=""/>
   		                 	<input type="hidden" id="whCode" name="whCode" value=""/>
   		                 </td>
   		            </tr>
   		            <tr>
   		                 <td nowrap>盘点人:</td>
   		                 <td>
   		                <input type="text" id="agent" name="agent" class="required" value="" />
   		                 </td>
   		                 <td>盘点时间:</td>
	   					<td><input id="pdDate" name="pdDate" class="required" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="<fmt:formatDate value="${pd.pdDate}" pattern="yyyy-MM-dd" type="both" />" /></td>
   		           </tr>
   		           <tr>
   		                 <td nowrap>选择文件:</td>
   		                 <td>
   		                <input type="file" id="filename" name="filename" class="required" value="" />
   		                 </td>
   		           </tr>
                </table>
         <div class="formBar">
	        <ul>
	           <li><div class="buttonActive"><div class="buttonContent"><button type="button" id="save" onclick="submitForm(1)">提交</button></div></div></li>
		       <li><div class="button"><div class="buttonContent"><button type="button" class="print" onclick="CloseDialog()">关闭</button></div></div></li>
	        </ul>
        </div>    
    </div>
</form>
</body>
</html>